import 'dart:collection';
import 'dart:math';

/// 通讯录实体类
class AddressBookModel{

  /// 姓名
  String? name;
  /// 头像地址
  String? avatar;
  /// 用户类型
  String? type;
  /// 联系电话
  String? phone;

  AddressBookModel({this.name, this.avatar, this.type, this.phone});

  @override
  String toString() {
    return 'AddressBookModel{name: $name, avatar: $avatar, type: $type, phone: $phone}';
  }

  static List<String> imageList = [
    "https://img.wxcha.com/m00/c1/a3/604308f978d9debcc8d5477e4f943d6b.jpg",
    "https://img.wxcha.com/m00/9c/f5/520c4265f1919263f27b757f501460e3.jpg",
    "https://img.wxcha.com/m00/55/82/2c0477a3d2256370e58b8ea5d0771169.jpg",
    "https://img.wxcha.com/m00/50/12/81b6ba3f79a9565ec32bd6d596a99944.jpg",
    "https://img.wxcha.com/m00/08/16/6cfad11f9dd28f01b97e4d3e6569a85b.jpg",
    "https://img.wxcha.com/m00/e2/d8/7b715d6aeee61f9cf108b10feec0a73f.jpg",
    "https://img.wxcha.com/m00/2f/53/1ec03bf507ce6aba9a2bb35f1cccf7a9.jpg",
    "https://img.wxcha.com/m00/49/ef/52e83209d7a3a291980796f7d1a7a3f5.jpg",
    "https://img.wxcha.com/m00/39/43/e6ae8ffa55fb94cb153dc68478f34487.jpg",
    "https://img.wxcha.com/m00/18/5f/257d71eb71ed372f9f812af3d24c9a3c.jpg",
    "https://img.wxcha.com/m00/bb/18/bc2167461f0ba311a992f3f00a45c58d.jpg",
    "https://img.wxcha.com/m00/f4/2b/495d63dd90b1e1856f175291b4716c06.jpg",
    "https://img.wxcha.com/m00/a5/2b/e8ac4a909012ffafac44bcbb405f38e8.jpg",
    "https://img.wxcha.com/m00/9e/71/4ad466d12aa081ab9dddc6794ccb2209.jpg",
    "https://img.wxcha.com/m00/59/06/e40ced6c6616c9659ec4dcef2d74cc1b.jpg",
    "https://img.wxcha.com/m00/e9/ae/d6d2634b3a656116d66973925f3ed697.jpg",
    "https://img.wxcha.com/m00/67/f4/9434169ed0464e31207fc544f44d8784.jpg",
    "https://img.wxcha.com/m00/69/e3/fb7af5bde53a50a82e826612c9d03f5d.jpg",
    "https://img.wxcha.com/m00/aa/65/26a2a68d8cb8a920ccbad35314252c73.jpg",
  ];

  /// 用户测试数据
  static List<Map<String, dynamic>> getAddressBookModelData(){
    List<Map<String, dynamic>> list = [];
    for(int i = 65; i < 91; i++){
      Map<String, dynamic> temp = HashMap();
      List<AddressBookModel> abs = [];
      String key = String.fromCharCode(i);
      for(int j = 1; j < 6; j++){
        abs.add(AddressBookModel(name: '${key}_name_$j', phone: '13247856$i$j', avatar: imageList[Random().nextInt(imageList.length - 1)]));
      }
      temp['group'] = key;
      temp['children'] = abs;
      list.add(temp);
    }
    return list;
  }



}